import { defineStore } from "pinia";
import { reqLogin } from "@/API/APIs/api";
import TypeSum from "@/TypeSum/entry";

export const useLoginStore = defineStore('LoginStore', {
    state() {
        return {}
    },
    actions: {
        async getLogin(data: { phone: number, password: string }) {
            const result = await reqLogin(data) as TypeSum['AxiosData']['AxiosData']
            if (result.code == 200) {
                return result.data
            } else {
                return Promise.reject(`出错了,理由是${result.message}`)
            }
        }
    }
})